Skip to content

fix: send decimal channel mask instead of binary string#22

Merged
tylerkron merged 1 commit intomainfrom
fix/channel-mask-binary-to-decimal
Apr 8, 2026
Merged

fix: send decimal channel mask instead of binary string#22
tylerkron merged 1 commit intomainfrom
fix/channel-mask-binary-to-decimal

Conversation

@tylerkron
Copy link
Copy Markdown
Contributor

Summary

  • IsValidChannelMask() only accepted binary strings (0s and 1s) and the --channels help text said "0/1 mask". The firmware's SCPI_ParamInt32 parses ENAble:VOLTage:DC as a decimal integer, so --channels 111 (intended as binary for ch 0,1,2) was parsed as decimal 111 = wrong channels.
  • Auto-generated all-channel mask used new string('1', adcCount) which for 8 channels produced "11111111" — firmware parses as decimal 11,111,111 instead of the correct 255.
  • IsValidChannelMask now validates decimal integers via uint.TryParse.
  • Auto-mask now computes (1 << count) - 1 (e.g. 255 for 8 channels).
  • Help text updated to show decimal bitmask format.

Related: daqifi/daqifi-desktop#439, daqifi/daqifi-core#160

Test plan

  • Build succeeds with local core
  • --channels 7 correctly logged only channels 0,1,2 on real hardware (Nq1 @ /dev/cu.usbmodem101) — downloaded file showed 3 analog values per sample

🤖 Generated with Claude Code

The firmware's SCPI_ParamInt32 parses ENAble:VOLTage:DC as a decimal
integer, but the example app was treating --channels as a binary string
and generating binary masks internally.

Changes:
- IsValidChannelMask: now validates decimal integers instead of 0/1 strings
- Auto-generated all-channel mask: uses (1 << count) - 1 instead of
  new string('1', count) which produced the wrong decimal value
- Help text: updated to show decimal bitmask examples

Tested on real hardware (Nq1 at /dev/cu.usbmodem101): --channels 7
correctly logged only channels 0,1,2 (3 analog values per sample).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tylerkron tylerkron merged commit 395b104 into main Apr 8, 2026
@tylerkron tylerkron deleted the fix/channel-mask-binary-to-decimal branch April 8, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant